<template>
    <div>
        <video width="100%" height="540px" src=""></video>
    </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'

onMounted(() => {
    getVideo()
})

const getVideo = async () => {
    const stream = await navigator.mediaDevices.getUserMedia({
        audio: true,
        video: true
    })

    let video = document.querySelector('video')
    video!.srcObject = stream
    video!.play()
    return stream
}
</script>

<style scoped lang="scss">

</style>